package com.cnciems.lakekb.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.service.Contact;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;

/**
 * @version V1.0
 * @program: lake-kb
 * @package: com.cnciems.lakekb.config
 * @description: 文档注释配置类,测试地址：http://localhost:8801/doc.html
 * @author: HHJ
 * @dep STATE GRID XIONG AN DIGITAL TECHNOLOGY Co.,Ltd
 * @create: 2021-05-24 13:33
 **/
@Configuration
@EnableSwagger2
public class SwaggerConfiguration {
    @Bean(value = "defaultApi2")
    public Docket defaultApi2() {
        Docket docket=new Docket(DocumentationType.SWAGGER_2)
                .apiInfo(apiInfo())
                .groupName("新版")
                .select()
                .apis(RequestHandlerSelectors.basePackage("com.cnciems.lakekb.course"))
                .paths(PathSelectors.any())
                .build();
        return docket;
    }
    private ApiInfo apiInfo() {
        return new ApiInfoBuilder()
                .title("智慧园区管理系统 ")
                .description("# 知识库API管理")
                .termsOfServiceUrl("http://www.cnciems.com/")
                .contact(new Contact("hhj","cnciems.com","364150754@qq.com"))
                .version("1.0.0")
                .build();
    }
}
